Skip to content

Update Microsoft.Windows/FirewallRuleList to support unspecifiedRulesAction property#1599

Open
SteveL-MSFT wants to merge 2 commits into
PowerShell:mainfrom
SteveL-MSFT:firewall-disable
Open

Update Microsoft.Windows/FirewallRuleList to support unspecifiedRulesAction property#1599
SteveL-MSFT wants to merge 2 commits into
PowerShell:mainfrom
SteveL-MSFT:firewall-disable

Conversation

@SteveL-MSFT

Copy link
Copy Markdown
Member

PR Summary

Added new unspecifiedRulesAction property with values:

  • ignore: same as if not specified, does nothing
  • disable: rules not specified become disabled (enabled set to false)
  • remove: rules not specified will be removed

The tests use --what-if to validate since i don't want to actually affect the system under test. Manually tested in a VM.

PR Context

Fix #1579

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the Microsoft.Windows/FirewallRuleList DSC resource to support an authoritative-mode behavior via a new unspecifiedRulesAction property, enabling “ignore/disable/remove” handling for firewall rules not included in the declared rules array (related to issue #1579’s drift-management needs).

Changes:

  • Adds unspecifiedRulesAction to the resource schema and Rust input model (Ignore|Disable|Remove).
  • Implements set-time handling to disable or remove rules that are not explicitly listed.
  • Adds Pester coverage for the new behavior using --what-if, plus new localized what-if messages.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
resources/windows_firewall/windows_firewall.dsc.resource.json Adds the unspecifiedRulesAction schema property for the resource input contract.
resources/windows_firewall/tests/windows_firewall_set.tests.ps1 Adds what-if tests validating ignore/disable/remove behavior for unspecified rules.
resources/windows_firewall/src/types.rs Introduces UnspecifiedRulesAction and wires it into FirewallRuleList.
resources/windows_firewall/src/firewall.rs Implements disable/remove behavior for rules not listed in input.
resources/windows_firewall/locales/en-us.toml Adds localized what-if strings for disabling/removing unspecified rules.
resources/windows_firewall/Cargo.toml Bumps the crate version to 0.2.0.
Cargo.lock Updates the workspace lockfile for the version bump.

Comment thread resources/windows_firewall/Cargo.toml
Comment thread resources/windows_firewall/windows_firewall.dsc.resource.json
Comment thread resources/windows_firewall/tests/windows_firewall_set.tests.ps1
Comment thread resources/windows_firewall/src/firewall.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement canonical _purge on Microsoft.Windows/FirewallRuleList for authoritative rule management

2 participants